package me.monster.smarttraffic.ui.bus;

import android.os.Bundle;

/**
 * @description
 * @author: Created jiangjiwei in 2020-02-13 16:48
 */
public class StationLeftFragment extends BaseBusFragment<BusPresenter> implements BusContract.View {


    public static StationLeftFragment newInstance() {
        Bundle args = new Bundle();
        StationLeftFragment fragment = new StationLeftFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void showLoading() {
        showProgress();
    }

    @Override
    public void dismissLoading() {
        hideProgress();
    }

    @Override
    public void showError(int error) {
        handleError(error);
    }

    @Override
    int getPositionInGroup() {
        return 0;
    }

    @Override
    void loopFetch() {
        mPresenter.fetchDistance(getPositionInGroup() + 1);
        mPresenter.fetchEnv(getPositionInGroup() + 1);
    }

    @Override
    public void onStart() {
        super.onStart();
        startLoop();
    }

    @Override
    public BusPresenter createPresenter() {
        return new BusPresenter();
    }

    @Override
    public void showEnv(String pm, String temp, String hum, String co) {
        setEnv(pm, temp, hum, co);
    }

    @Override
    public void showDistance(int distance1, int distance2) {
        setBusDistance(distance1, distance2);
    }
}
